package com.slofzx.nuoda.evaluation.param.enums;

import com.slofzx.nuoda.common.EnumConfig;
import com.slofzx.nuoda.common.config.Type;

/**
 * 公共参数版本状态枚举
 * @author sunhaifeng
 */
@EnumConfig(
    id = "param-version-state",
    name = "公共参数版本状态"
)
public enum ParamVersionStateEnum implements Type {
    INIT("init", "未发布",1),
    PUBLISH("publish", "已发布",2);

    /**
     * 标识
     */
    private String id;
    /**
     * 名称
     */
    private String name;
    /**
     * 排序值
     */
    private double sort;

    ParamVersionStateEnum(String id, String name, double sort) {
        this.id = id;
        this.name = name;
        this.sort = sort;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    /**
     * 根据标识获取枚举值
     * @param id
     * @return
     */
    public static ParamVersionStateEnum getEnum(String id) {
        for(ParamVersionStateEnum item:values()) {
            if (item.getId().equals(id)) {
                return item;
            }
        }

        return null;
    }
}
